import { createApp } from 'vue';  // 直接使用根目录的 vue
import "virtual:svg-icons-register";
import App from './App.vue';
import { createPinia } from 'pinia'; // 导入Pinia及类型

import 'element-plus/dist/index.css';
import './common/style.css';

import zhCn from "element-plus/es/locale/lang/zh-cn";
import ElementPlus from "element-plus";
import * as ElementPlusIconsVue from '@element-plus/icons-vue';

import XcForm from '@xc-components/xc-form';
import XcTable from '@xc-components/xc-table';

const app = createApp(App);

const pinia = createPinia();
// 3. 注册Pinia到Vue应用（关键：让Vue实例关联Pinia）
app.use(pinia);

app.use(ElementPlus, { locale: zhCn });
// 统一注册所有 Element Plus 图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

app.component('XcForm', XcForm);
app.component('XcTable', XcTable);

app.mount('#app');
